<template>
	<view v-if="isLoaded">
		<li-report
			height="900"
			:param.sync="param"
			:radios.sync="radios"
			:reportData="tableData"
			:columns="columns"
			label="报表类型"
			typeName="type"
			v-on:changeType="changeType($event)"
			:isShowLoadMore="isShowLoadMore"
		>
			<template #li>
				<u-form>
					<u-form-item label="单据编号" prop="orderId" labelWidth="auto">
						<li-input v-model="param.orderId" rule="trim" />
					</u-form-item>
				</u-form>
			</template>
		</li-report>
	</view>
</template>

<script>
import date from '@/utils/date';
import LiReportMixin from '../../../mixins/liReportMixin.js';
export default {
	mixins: [LiReportMixin],
	data() {
		return {
			isShowLoadMore: true,
			reportFn: 'GetPageReport',
			param: {
				dataTimeRange: [date.getToday(), date.getToday()],
				pageNum: 1,
				pageSize: 20,
				type: 1,
				orderId: '',
				reportId: 301
			},
			radios: [
				{ name: '消费', value: 1, selected: true },
				{ name: '充值', value: 3 }
			],
			columns: [
				{
					name: 'id',
					label: '消费编号',
					fixed: true
				},
				{
					name: 'date',
					label: '日期',
					fixed: false
				},
				{
					name: 'orderId',
					label: '单据编号',
					fixed: false
				},
				{
					name: 'grade',
					label: '会员分类',
					fixed: false
				},
				{
					name: 'userName',
					label: '会员姓名',
					fixed: false
				},
				{
					name: 'number',
					label: '会员卡号',
					fixed: false
				},
				{
					name: 'money',
					label: '消费金额',
					fixed: false
				},
				{
					name: 'giftAmount',
					label: '赠送金额',
					fixed: false
				},
				{
					name: 'balance',
					label: '结存余额',
					fixed: false
				},
				{
					name: 'cardNumber',
					label: '次卡编码',
					fixed: false
				},
				{
					name: 'cardName',
					label: '次卡名称',
					fixed: false
				},
				{
					name: 'quantity',
					label: '次卡次数',
					fixed: false
				}
				/*      {
          name: "paymentId",
          label: "付款方式",
          fixed: false,
        }, */
			]
		};
	},

	methods: {
		changeType(e) {
			if (this.param.type === 3) {
				this.columns[0].label = '充值编号';
				this.columns[6].label = '充值金额';
			} else if (this.param.type === 1) {
				this.columns = this.$options.data().columns;
			}
		}
	}
};
</script>
